/*--Advertising slide--*/
var t = n = 0, count = $("#slidelist a").size();
$(function(){
	$("#date").val(TomorrowToStr());
	$("#enddate").val(nextDayToStr(TomorrowToStr()));
	$("#slidelist a:not(:first-child)").hide();
	$("#slideinfo").html($("#slidelist a:first-child").find("img").attr('alt'));
	$("#slidetext li:first-child").css({"background":"#ffffff"});
	$("#slidetext li:first-child").css({"border":"#ff7a02 solid 1px"});
	$("#slideinfo").click(function(){window.open($("#slidelist a:first-child").attr('href'), "_blank")});
	$("#slidetext li").click(function() {
		var i = $(this).text() - 1;
		n = i;
		if (i >= count) return;
		$("#slideinfo").html($("#slidelist a").eq(i).find("img").attr('alt'));
		$("#slideinfo").unbind().click(function(){window.open($("#slidelist a").eq(i).attr('href'), "_blank")})
		$("#slidelist a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
		$(this).css({"background":"#ffffff"}).siblings().css({"background":"#0070a2"});
		$(this).css({"border":"#ff7a02 solid 1px"}).siblings().css({"border":"#418dc0 solid 1px"});
	});
	t = setInterval("showAuto()", 7000);
	$("#slide").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 7000);});
	$("#prev").click(function() {
	--n;
	if (n<0) {
	n=count-1;
	}
	$("#slidetext li").eq(n).trigger('click');
	});
	$("#next").click(function() {
	++n;
	if (n >count-1) {
	n=0;
	}
	$("#slidetext li").eq(n).trigger('click');
	});

})
